package ua.simplecoding.kievhome.converter;

import ua.simplecoding.kievhome.domain.AppartmentAddress;
import ua.simplecoding.kievhome.vo.AppartmentAddressVO;

/**
 * User: dmytro.fedotov
 * Date: 03.07.11
 */
public class AppartmentAddressVOConverter extends AbstractVOConverter<AppartmentAddress, AppartmentAddressVO> {

    @Override
    public AppartmentAddressVO convert(AppartmentAddress appartmentAddress) {
        AppartmentAddressVO addressVO = new AppartmentAddressVO();
        addressVO.setPk(appartmentAddress.getPk());

        if (appartmentAddress.getCity() != null) {
            addressVO.setCity(appartmentAddress.getCity().getName());
        }
        addressVO.setHouseNo(appartmentAddress.getHouseNo());
        addressVO.setStreetName(appartmentAddress.getStreetName());
        return addressVO;
    }
}
